import axios from "axios";

const baseUrl = "/api/router";
const axiosInstance = axios.create({
  baseURL: baseUrl,
  timeout: 1200000,
  headers: {},
});

export function get(url, params) {
  return new Promise((resolve, reject) => {
    axiosInstance
      .get(`${url}/${params}`)
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
}

export function post(url, data) {
  return new Promise((resolve, reject) => {
    axiosInstance
      .post(url, data)
      .then((res) => {
        resolve(res);
      })
      .catch((err) => {
        reject(err);
      });
  });
}
